<!DOCTYPE html>
<html lang='en'>

<head>
  <meta charset='UTF-8'>
  <meta name='viewport' content='width=device-width, initial-scale=1.0'>
  <title></title>
  <script type='text/javascript' src='js/vue.js'></script>
</head>

<body>
  <div id='app'>
    <h3 :style="{fontSize: fs+'px'}">我是父组件的标题</h3>
    <div>
      <menu-item @enlarge-text="big"></menu-item>
    </div>
  </div>
  <script type='text/javascript'>
    Vue.component('menu-item', {
      template: `
        <div>
          <button @click="enlarge"> 扩大父组件字体 </button>  
          <button @click="enlargeBig"> 扩大父组件字体 </button>  
        </div>
      `,
      data() {
        return {
          fs: 14
        }
      },
      methods: {
        enlarge() {
          this.$emit("enlarge-text", ++this.fs)
        },
        enlargeBig(){
          this.$emit("enlarge-text", this.fs += 10)
        }
      }
    })
    var vm = new Vue({
      el: '#app',
      data: {
        fs: 12,
      },
      methods: {
        big(val) {
          this.fs = Number(val);
        }
      }
    });
  </script>
</body>

</html>